@extends('layout.wechat_frame')

@section('main')

    <header class="mui-bar mui-bar-nav">
        <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
        <h1 class="mui-title">{{ $basket->name }}-供应物料查看</h1>
    </header>
    <div class="mui-content">
        <ul class="mui-table-view mui-table-view-striped mui-table-view-condensed">
            <li class="mui-table-view-cell">
                <h4 class="mui-ellipsis" style="margin-bottom: 10px">{{ $offer_information->goods->name }}</h4>
                <h5 class="ips-text-red" >质量指标:</h5>
                <textarea id="textarea" class="ips-textarea" rows="5" placeholder="" readonly>{{ old('quality_standard', $offer_information->quality_standard) }}</textarea>
                <h5 class="mui-ellipsis"><span class="ips-span-first">可供数量：</span><span>

                        @if ($offer_information->quantity >= 0)
                            {{ strval((float)$offer_information->quantity) }} 吨
                        @else
                            不限
                        @endif

                    </span></h5>
                <h5 class="mui-ellipsis"><span class="ips-span-first">收款方式：</span><span>{{ $offer_information->payment }}</span></h5>
                <h5 class="mui-ellipsis"><span class="ips-span-first">报价有效期：</span><span>报价后{{ $offer_information->price_validity }}小时</span></h5>
                <h5 class="mui-ellipsis"><span class="ips-span-first">交货日期：</span><span>{{ explode(' ', $offer_information->delivery_start)[0] }} 至 {{ explode(' ', $offer_information->delivery_stop)[0] }}</span></h5>
                <h5 class="mui-ellipsis"><span class="ips-span-first">线下议价：</span><span>{{ $offer_information->bargaining?'接受':'不接受' }}</span></h5>
            </li>
        </ul>
    </div>

    @if (!empty(old('prices', $offer_information->prices)))
        @foreach (old('prices', $offer_information->prices) as $k => $v)
            <div class="mui-content ips-mui-content-no-top">
                <ul class="mui-table-view mui-table-view-striped mui-table-view-condensed">
                    <li class="mui-table-view-cell">
                        <h5><span class="ips-span-left">单价（元/吨）</span><span class="ips-span-right-tc">交货地点</span></h5>

                        @if (!empty(old('addresses.'.$k, $offer_information->addresses[$k])))
                            <?php
                            $int = 0;
                            ?>
                            @foreach (old('addresses.'.$k, $offer_information->addresses[$k]) as $type => $val_list)
                                @if (!empty($val_list))
                                @if ($int == 0)
                                    <h5><span class="ips-span-left">{{ $v }}</span><span class="ips-span-right">{{$val_list[0]}}</span></h5>
                                @else
                                        <h5><span class="ips-span-left"></span><span class="ips-span-right">{{$val_list[0]}}</span></h5>
                                @endif
                                    <?php
                                    $int = $int + 1;
                                    ?>
                                @endif
                            @endforeach
                        @endif
                    </li>
                </ul>
            </div>
        @endforeach
    @endif

@section('js')
@stop